//MyGenericsCollection.java
package com.xyc.ch8;
import java.util.*;

public class MyGenericCollection{
   public static void main(String[] args)  {
	   List<Integer> myList=new ArrayList<Integer>();
//	   myList.add("A string");		编译错误
	   myList.add(new Integer(1));
	   myList.add(new Integer(2));

	   Integer x;
	   for(int i=0;i<myList.size();i++)
	   {
		   x=myList.get(i);
		   System.out.println (x);
	   }
   }
}





